<?php

namespace app\admin\model;

use think\Model;


class City extends Model
{

    

    

    // 表名
    protected $name = 'city';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];
    

    public static function getList($province_code)
    {
        
        $list = self::all(['ProvinceCode'=>$province_code]);
        
        $list = collection($list)->toarray();
        
        $arr = [];
        foreach ($list as $k => $v) {
            
            $arr[$k]['Code'] = $v['Code'];
            $arr[$k]['Name'] = $v['Name'];
        }

        return $arr;
    }

     public static function getListOnearr($province_code)
    {

        $list = self::all(['ProvinceCode'=>$province_code]);
        
        $list = collection($list)->toarray();
        
        $arr = [];
        foreach ($list as $k => $v) {
            $arr[$v['Code']] = $v['Name'];
            // $arr[$k]['Code'] = $v['Code'];
            // $arr[$k]['Name'] = $v['Name'];
        }

        return $arr;
    }





}
